package com.firebird.app.reader.pdf.bean

import android.os.Parcel
import android.os.Parcelable

/**
 *
 */
class PDFFileInfo : Parcelable {
    private var fileName: String? = null
    private var filePath: String? = null
    var fileSize: Long = 0
    private var time: String? = null
    var isSelect = false

    fun getFilePath(): String {
        return if (filePath == null) "" else filePath!!
    }

    fun setFilePath(filePath: String?) {
        this.filePath = filePath
    }

    fun getFileName(): String {
        return if (fileName == null) "" else fileName!!
    }

    fun setFileName(fileName: String?) {
        this.fileName = fileName
    }

    fun getTime(): String {
        return if (time == null) "" else time!!
    }

    fun setTime(time: String?) {
        this.time = time
    }

    override fun describeContents(): Int {
        return 0
    }

    override fun writeToParcel(dest: Parcel, flags: Int) {
        dest.writeString(fileName)
        dest.writeString(filePath)
        dest.writeLong(fileSize)
        dest.writeString(time)
    }

    constructor() {}
    protected constructor(`in`: Parcel) {
        fileName = `in`.readString()
        filePath = `in`.readString()
        fileSize = `in`.readLong()
        time = `in`.readString()
    }

    override fun toString(): String {
        return "PDFFildeInfo{" +
                "fileName='" + fileName + '\'' +
                ", filePath='" + filePath + '\'' +
                ", fileSize=" + fileSize +
                ", time='" + time + '\'' +
                ", isSelect=" + isSelect +
                '}'
    }

    companion object {
        val CREATOR: Parcelable.Creator<PDFFileInfo> =object: Parcelable.Creator<PDFFileInfo> {
            override fun createFromParcel(source: Parcel): PDFFileInfo {
                return PDFFileInfo(source)
            }

            override fun newArray(size: Int): Array<PDFFileInfo> {
                return Array<PDFFileInfo>(size)
            }
        }
    }
}